package com.liuzh.deviceinfo.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

public class GrayBoxView extends View {
    public int a = -1;
    public Paint b = new Paint(1);

    public GrayBoxView(Context context) {
        super(context);
    }

    public int getCount() {
        return this.a;
    }

    public void onDraw(Canvas canvas) {
        if (this.a >= 1) {
            int ceil = (int) Math.ceil((double) (((((float) getHeight()) * 1.0f) / ((float) this.a)) * 1.0f));
            int i = 0;
            while (true) {
                int i2 = this.a;
                if (i < i2) {
                    int i3 = (256 / i2) * i;
                    this.b.setColor(Color.rgb(i3, i3, i3));
                    i2 = ceil * i;
                    canvas.drawRect(0.0f, (float) i2, (float) getWidth(), (float) (i2 + ceil), this.b);
                    i++;
                } else {
                    return;
                }
            }
        }
    }

    public void setCount(int i) {
        this.a = i;
        invalidate();
    }
}
